package app.cn.beautydressing.ui.activity;

import android.media.MediaPlayer;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import app.cn.beautydressing.R;
import app.cn.beautydressing.view.CustomVideoView;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

// 引导页
public class SplashActivity extends AppCompatActivity {

    @InjectView(R.id.videoView)
    CustomVideoView videoView;
    @InjectView(R.id.btn_login)
    Button btnLogin;
    @InjectView(R.id.btn_join)
    Button btnJoin;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        ButterKnife.inject(this);
        // 初始化播放加载路径
        initVideoPath();
    }

    private void initVideoPath() {
        //设置播放加载路径
//        videoView.setVideoURI(Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.media));
        //播放
        videoView.start();
        //循环播放
        videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mediaPlayer) {
                videoView.start();
            }
        });

    }

    @OnClick({R.id.btn_login, R.id.btn_join})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.btn_login:
                break;
            case R.id.btn_join:
                break;
        }
    }
}
